﻿

namespace LxCFD
{
    public class RhieChow_2ndOrderTrans : RhieChow_1stOrderTrans
    {
        public Vector3d[] RhoVel_oo;
        public override Vector3d CalVelocityCorrection_Inner(int faceID, ref FvFace face)
        {
            return Vel_o[faceID] = Vector3d.XXYYZZProduct(
                face.CalAverage(Dc),
                -face.CalCFGradCorrection_inner(PressureGrad, Pressure)
                - TransientDataBase.Factor_PhiO_2ndOrder * RhoVel_o[faceID] - TransientDataBase.Factor_PhiOO_2ndOrder * RhoVel_oo[faceID]
                );
        }
        public override Vector3d CalVelocityCorrection_Bound(int faceID, ref FvFace face)
        {
            return Vel_o[faceID] = Vector3d.XXYYZZProduct(
                Dc[face.OSideCell],
                -face.CalCFGradCorrection_bound(PressureGrad, Pressure)
                - TransientDataBase.Factor_PhiO_2ndOrder * RhoVel_o[faceID] - TransientDataBase.Factor_PhiOO_2ndOrder * RhoVel_oo[faceID]
                );
        }
    }
}
//public double beforePhiO_2ndOrder;
//public double beforePhiOO_2ndOrder;
//public override void UpdateParameter(VelocityVector.TransientVelRecorder velRecorder)
//{
//    if (AppRes.solveCenter.transientTime.isImplicit)
//    {
//        AppRes.solveCenter.transientTime.GetCoefficient_2ndOrderImplicit(out double beforePhi, out beforePhiO, out beforePhiOO);
//    }
//    else
//    {
//        AppRes.solveCenter.transientTime.GetCoefficient_2ndOrderExplicit(out double beforePhi, out beforePhiO, out beforePhiOO);
//    }

//    this.rhoVel_o = velRecorder.rhoVel_o;
//    this.rhoVel_oo = velRecorder.rhoVel_oo;
//    this.vel_o = velRecorder.vel_o;
//}